package com.itheima.mapper;

import com.itheima.pojo.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentMapper {

	@Insert("insert into comment(userId, ArticleId, comment, create_time) values(#{userId},#{articleId},#{comment},#{createTime})")
	void add(Comment comment);

	@Select("select c.id,c.comment,c.create_time,u.user_pic,u.nickname from comment c,user u,article a where c.userId = u.id and a.id = c.articleId and a.id = #{id}")
	List<Comment> select(int id);

}
